Skip to content

refactor: use pandas Timestamp and Timedelta#216

Merged
smlloyd merged 1 commit intomasterfrom
pandas-datetime
Feb 20, 2026
Merged

refactor: use pandas Timestamp and Timedelta#216
smlloyd merged 1 commit intomasterfrom
pandas-datetime

Conversation

@smlloyd
Copy link
Copy Markdown
Member

@smlloyd smlloyd commented Feb 20, 2026


📚 Documentation preview 📚: https://aimbat--216.org.readthedocs.build/en/216/

Copilot AI review requested due to automatic review settings February 20, 2026 12:52
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 92.54902% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.37%. Comparing base (8ee5772) to head (5dc0263).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/aimbat/cli/iccs.py 14.28% 36 Missing ⚠️
src/aimbat/core/_seismogram.py 88.00% 9 Missing ⚠️
src/aimbat/core/_iccs.py 50.00% 3 Missing ⚠️
src/aimbat/models/_sqlalchemy.py 91.66% 3 Missing ⚠️
src/aimbat/_lib/validators.py 77.77% 2 Missing ⚠️
src/aimbat/aimbat_types/_pydantic.py 92.59% 2 Missing ⚠️
src/aimbat/cli/seismogram.py 96.36% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #216      +/-   ##
==========================================
+ Coverage   93.31%   94.37%   +1.06%     
==========================================
  Files          33       45      +12     
  Lines        1615     1707      +92     
==========================================
+ Hits         1507     1611     +104     
+ Misses        108       96      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors AIMBAT to use pandas Timestamp and Timedelta types instead of Python's built-in datetime and timedelta. This change improves nanosecond precision handling and provides better integration with pandas-based data processing.

Changes:

  • Added pandas and pandas-stubs dependencies (version 3.0.1+)
  • Implemented custom SQLAlchemy type decorators for pandas Timestamp/Timedelta
  • Refactored all datetime/timedelta types across models, core modules, and CLI
  • Reorganized code structure (created aimbat_types, utils, core modules)
  • Updated configuration system to use log_level instead of debug flag

Reviewed changes

Copilot reviewed 67 out of 71 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock, pyproject.toml Added pandas>=3.0.1 and pandas-stubs>=3.0.0.260204 dependencies
src/aimbat/models/_sqlalchemy.py New SQLAlchemy type decorators for Timestamp/Timedelta with UTC handling
src/aimbat/aimbat_types/_pydantic.py Pydantic validators for pandas types with positive/negative constraints
src/aimbat/models/_models.py Updated all datetime fields to use PydanticTimestamp, timedelta to PydanticTimedelta
src/aimbat/_lib/validators.py Validators for positive/negative Timedelta values
src/aimbat/_config.py Changed debug bool to log_level Literal, updated Timedelta fields
src/aimbat/utils/* Reorganized utility functions, added timestamp_formatter
src/aimbat/core/* Updated all core modules to use Timestamp/Timedelta types
src/aimbat/cli/* Updated CLI to handle Timedelta parameters
tests/* Updated test fixtures and assertions for timestamp comparisons
Comments suppressed due to low confidence (3)

src/aimbat/core/_event.py:114

  • This commented-out function definition should be removed. The function get_active_event has been moved to utils._active_event and is imported in the __all__ list above. Keeping commented-out code decreases maintainability.
    src/aimbat/utils/_sampledata.py:9
  • Typo in __all__ definition: it should be __all__ (two underscores) not __all_ (one underscore). This means the exports won't work correctly.
    src/aimbat/core/_project.py:19
  • Typo in __all__ definition: it should be __all__ (two underscores) not ___all__ (three underscores). This means the exports won't work correctly.

Comment thread src/aimbat/aimbat_types/_pydantic.py Outdated
Comment thread src/aimbat/core/_station.py Outdated
@smlloyd smlloyd force-pushed the pandas-datetime branch 3 times, most recently from dd7f6cb to 7f2b153 Compare February 20, 2026 13:05
@smlloyd smlloyd merged commit e119129 into master Feb 20, 2026
22 of 23 checks passed
@smlloyd smlloyd deleted the pandas-datetime branch February 20, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants